package com.base.taskreports.reports.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.base.taskreports.common.annotation.Resubmit;
import com.base.taskreports.common.annotation.TBatchLog;
import com.base.taskreports.common.utlis.DateUtil;
import com.base.taskreports.common.utlis.response.Result;
import com.base.taskreports.reports.entiyt.master.TIndicatorsEntity;
import com.base.taskreports.reports.service.TIndicatorsService;
import com.base.taskreports.reports.service.TblCqpntPointInFlowService;
import com.base.taskreports.reports.service.TblCqpntPointOutFlowService;
import com.base.taskreports.reports.service.TblGwTransDetailService;
import com.base.taskreports.task.service.JfsService;
import com.base.taskreports.task.service.JfuService;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@RestController
@RequestMapping("/JFY")
public class JfyController {
	
	@Autowired
	private TblCqpntPointOutFlowService tblCqpntPointOutFlowService;
	
	@Autowired
	private TIndicatorsService tIndicatorsService;
	
	@Autowired
	private JfuService JfyService;
	
	@Autowired
	private JfsService JfsService;
	@Autowired
	private TblGwTransDetailService TblGwTransDetailService;
	
	@Autowired
	private TblCqpntPointInFlowService tblCqpntPointInFlowService;
	
	//外部积分（转接/兑换）承兑金额浮动告警
	@RequestMapping("/JFU_M001")
	@ResponseBody
	@TBatchLog("JFU_M001")
	@Resubmit(delaySeconds = 10)
	public Result JFU_M001(String strDate) {
		try {
			String DateTime = strDate;
			if(StringUtils.isEmpty(DateTime)) {
				//如果是空 默认当前时间
				DateTime = DateUtil.getToday();			
			}
			JfyService.getJFU_M001( DateTime);
		} catch (Exception e) {
			return new Result().error();
		}
		return new Result().ok();
		
	}
	//各积分类别消费中各支付产品类型笔数占比浮动
	@RequestMapping("/JFU_M002")
	@ResponseBody
	@TBatchLog("JFU_M002")
	@Resubmit(delaySeconds = 10)
	public Result JFU_M002(String strDate) {
		try {
			String DateTime = strDate;
			if(StringUtils.isEmpty(DateTime)) {
				//如果是空 默认当前时间
				DateTime = DateUtil.getToday();			
			}
			//各积分类别消费中各支付产品类型笔数占比浮动
			JfyService.getJFU_M002( DateTime);
		} catch (Exception e) {
			return new Result().error();
		}
		return new Result().ok();
		

	}
	//各积分类别消费中各支付产品类型金额占比浮动
	@RequestMapping("/JFU_M003")
	@ResponseBody
	@TBatchLog("JFU_M003")
	@Resubmit(delaySeconds = 10)
	public Result JFU_M003(String strDate) {
		try {
			String DateTime = strDate;
			if(StringUtils.isEmpty(DateTime)) {
				//如果是空 默认当前时间
				DateTime = DateUtil.getToday();			
			}
			//各积分类别消费中各支付产品类型金额占比浮动
			JfyService.getJFU_M003( DateTime);
		} catch (Exception e) {
			return new Result().error();
		}
		return new Result().ok();
		
		
	}
	//积分撤销/冲正/退货反向交易笔数占比浮动
	@RequestMapping("/JFU_M004")
	@ResponseBody
	@TBatchLog("JFU_M004")
	@Resubmit(delaySeconds = 10)
	public Result selectFloatingProportionAmountRachTypeProductPaidConsumptionPointsNumberTransaction(String strDate) {
		try {
			String DateTime = strDate;
			if(StringUtils.isEmpty(DateTime)) {
				//如果是空 默认当前时间
				DateTime = DateUtil.getToday();			
			}
			//积分撤销/冲正/退货反向交易笔数占比浮动
			JfyService.getJFU_M004( DateTime);
		} catch (Exception e) {
			return new Result().error();
		}
		return new Result().ok();
		
		
	}
	//积分撤销/冲正/退货反向交易金额占比浮动
	@RequestMapping("/JFU_M005")
	@ResponseBody
	@TBatchLog("JFU_M005")
	@Resubmit(delaySeconds = 10)
	public Result JFU_M005(String strDate) {
		try {
			String DateTime = strDate;
			if(StringUtils.isEmpty(DateTime)) {
				//如果是空 默认当前时间
				DateTime = DateUtil.getToday();			
			}
			//积分撤销/冲正/退货反向交易金额占比浮动
			JfyService.getJFU_M005( DateTime);

		} catch (Exception e) {
			return new Result().error();
		}
		return new Result().ok();
		
		
	}
	//营销系统系统成功率
	@RequestMapping("/JFU_M006")
	@ResponseBody
	@TBatchLog("JFU_M006")
	@Resubmit(delaySeconds = 10)
	public Result JFU_M006(String strDate) {
		try {
			String DateTime = strDate;
			if(StringUtils.isEmpty(DateTime)) {
				//如果是空 默认当前时间
				DateTime = DateUtil.getToday();			
			}
			//营销系统系统成功率
			JfyService.getJFU_M006( DateTime);
		} catch (Exception e) {
			return new Result().error();
		}
		return new Result().ok();
		

	}
	//积分兑换价值比不为1笔数
	@RequestMapping("/JFU_M007")
	@ResponseBody
	@TBatchLog("JFU_M007")
	@Resubmit(delaySeconds = 10)
	public Result JFU_M007(String strDate) {
		try {
			String DateTime = strDate;
			if(StringUtils.isEmpty(DateTime)) {
				//如果是空 默认当前时间
				DateTime = DateUtil.getToday();			
			}
			//积分兑换价值比不为1笔数
			JfyService.getJFU_M007(DateTime);
		} catch (Exception e) {
			// TODO: handle exception
			return new Result().error();
		}
		return new Result().ok();
		
		
	}
	
	
	//已失效积分金额浮动比率
	@RequestMapping("/JFU_M008")
	@ResponseBody
	@TBatchLog("JFU_M008")
	@Resubmit(delaySeconds = 10)
	public Result JFU_M008(String strDate) {
		try {	
			String DateTime = strDate;
			if(StringUtils.isEmpty(DateTime)) {
				//如果是空 默认当前时间
				DateTime = DateUtil.getToday();			
			}
			//已失效积分金额浮动比率
			JfyService.getJFU_M008(DateTime);
			
		} catch (Exception e) {
			// TODO: handle exception
			return new Result().error();
		}
	  return new Result().ok();
	}
	
}